$("#commit").click(function(e){
	
	//获取到参数
	var money = $("#money").val();
	var user = $("#user").val();
	var bank = $("#bank").val();
	var belongbank = $("#belongbank").val();
	var account = $("#account").val();
    var balance = $("#balance").text();
	
	var flag = true ;
	//进行格式校验
	flag = checkReg(user, "#2Tip")?flag:checkReg(user, "#2Tip");
	flag = checkReg(bank, "#3Tip")?flag:checkReg(bank, "#3Tip");
	flag = checkReg(belongbank, "#4Tip")?flag:checkReg(belongbank, "#4Tip");
	flag = checkReg(account, "#5Tip")?flag:checkReg(account, "#5Tip");
	//进行判断格式
    var reg = /^\d+(?=\.{0,1}\d+$|$)/;    
    if(money==null || money =="" || money == undefined){	
    	$("#1Tip").text("不能为空");
    	flag = false ;
    }else{
    	if(!reg.test(money)){
    		$("#1Tip").text("金额为数字");
    		flag = false;
    	}else{
    		if(Number(balance)< 50){
    		      $("#1Tip").text("不足以提现");
    		      flag = false ;
    	        }else{
    	        	if(Number(money)<50){
    	        		$("#1Tip").text("金额需大于50元");
    	        		flag =false ; 
    	        	}else if(Number(money)>Number(balance)){
    	        		$("#1Tip").text("余额不足");
    	        		flag = false;
    	        	}else {
    	        		$("#1Tip").text("");
    	        	}
    	        }    	   
    	}
    }    
    if(flag){
    	//进行格式的校验
        var json = {
        	"money":money,
        	"accountHolder":user,
        	"account":account,
        	"accountBank":bank,
        	"accountSubbranch":belongbank,
        }
        //成功回调函数
        var success = function(data){
        	
        	if(data.code == 0){//余额不足以提现
        		$("#1Tip").text("余额不足以提现");
        		$("#balance").text(data.balance);
        		$("#doing").text(data.doing);
        		$("#success").text(data.success);

        	}else if(data.code ==1){//余额不足
        		$("#1Tip").text("余额不足");
        		$("#balance").text(data.balance);
        		$("#doing").text(data.doing);
        		$("#success").text(data.success);
        	}else {//体现成功
            	alert("提交成功,我们将在24小时内进行处理");   
            	$("#balance").text(data.balance);
        		$("#doing").text(data.doing);
        		$("#success").text(data.success);
        	}
        }
        //失败回调函数
        var error = function(){
        	alert("提交失败");
        }       
        //参数和url
        var params ="jsonStr="+JSON.stringify(json);
        var url = base_url + "customer/commitWithdraws";
        //进行提现请求
        doAjax("POST", url, params, success, error, true, false);    	
    }
 
})

//进行格式的检验
function checkReg(obj1, obj2) {

	//如果为空或者不是字符串，则把标志设置成false
	if (obj1 == null || obj1 == "" || obj1 == undefined) {
		$(obj2).show();
		return false;
	}else{
		$(obj2).hide();
	}
	return true ;
}